<!DOCTYPE html>
<html>

	<head lang="en">
		<title>酒店评论</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.css">
		<script src="/js/jquery/jquery.min.js"></script>
		<script src="/js/bootstrap/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
		<link rel="stylesheet" href="/css/reset.css" />
		<link rel="stylesheet" href="/css/myStrategyComment.css" />
		<script src="/js/plugins/jrender/jrender.js"></script>
		<link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
		<script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
		<script src="/js/plugins/jquery-form/jquery.form.js"></script>
		<script src="/js/common.js"></script>
		<script>
            $(function () {
                var hotelId = getParams().hotelId;
                console.log(hotelId);
                var user = JSON.parse(sessionStorage.getItem("user"));
                console.log(user.id);
                $("#commentForm input[name='user.id']").val(user.id);
                $("#commentForm input[name='hotel.id']").val(hotelId);
                $("#user.id").val(user.id);

                //设置表单的action
                $("#commentForm").attr("action", "/hotels/"+hotelId+"/comments");

                $("#submitBtn").click(function () {
					$("#commentForm").ajaxSubmit(function (data) {
					    if(data.success){
					        location.href="javascript:window.history.go(-1)";
						}
                    })
                });

            });
		</script>
	</head>

	<body>
	<div class="search-head">
		<div class="row nav-search">
			<div class="col">
				<a href="javascript:window.history.go(-1)">
					<span><i class="fa fa-chevron-left" ></i></span>
				</a>

			</div>
			<div class="col">
				<span>点评</span>
			</div>
			<div class="col"></div>
		</div>
	</div>

	<div class="comment">
		<form id="commentForm" method="post">
			<input type="hidden" name="user.id">
			<input type="hidden" name="hotel.id">
			<div class="container star">
				<p>你对该酒店的评价</p>
				<div class="form-group">
					<label class="col-lg-4 control-label">你对该酒店的评价：</label>
					<div class="col-lg-6">
						<select class="form-control" name="starNum">
							<option value="5">好评</option>
							<option value="4">较好</option>
							<option value="3">中评</option>
							<option value="2">较差</option>
							<option value="1">差评</option>
						</select>
					</div>
				</div>
			</div>
			<hr />
			<div class="container tag">

				<p>评价内容</p>
				<textarea name="content" class="form-control" rows="5" placeholder="请填写你对该旅游地的评价"></textarea>
			</div>
		</form>

	</div>



	<div class="operation">
		<button class="btn" onclick="window.history.go(-1)">放弃评价</button>
		<button class="btn" id="submitBtn">提交评价</button>
	</div>






	</body>


</html>